package com.jinmdz.fmis.core.constant;


/**
 * 员工用户编码枚举
 *
 * @author LiCongLu
 * @date 2020-01-15 11:40
 */
public enum ERoleCode {
    EMPTY("", "空"),
    /**
     * 洽谈员
     */
    NEGOTIATOR_USER("negotiator_user", "洽谈员"),
    /**
     * 接运司机
     */
    TRANSPORT_TASK_DRIVER_USER("transport_task_driver_user", "接运司机"),
    /**
     * 抬尸工
     */
    TRANSPORT_TASK_PORTER("transport_task_porter", "抬尸工");

    /**
     * 枚举值
     */
    private String code;
    /**
     * 枚举信息
     */
    private String message;

    private ERoleCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public ERoleCode setCode(String code) {
        this.code = code;
        return this;
    }

    public String getMessage() {
        return message;
    }

    public ERoleCode setMessage(String message) {
        this.message = message;
        return this;
    }

    /**
     * code
     *
     * @param code 枚举值
     * @return
     * @author LiCongLu
     * @date 2020-01-15 11:43
     */
    public static ERoleCode getERoleCode(String code) {
        if (code != null) {
            for (ERoleCode typeEnum : ERoleCode.values()) {
                if (typeEnum.getCode() != null) {
                    if (typeEnum.getCode().equals(code)) {
                        return typeEnum;
                    }
                }
            }
        }
        return ERoleCode.EMPTY;
    }

    /**
     * 判断枚举与code值是否相等
     *
     * @param code 枚举值
     * @return
     * @author LiCongLu
     * @date 2020-01-15 11:43
     */
    public boolean equalEnum(String code) {
        return this.getCode().equals(code);
    }
}
